package com.example.service;

import com.example.entity.User;
import com.example.aspect.InvokeLog;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

/**
 * @Auther: tong
 * @Date: 2023/01/18/23:29
 * @Description:
 */
@Service
public class UserService {
    @InvokeLog
    public void addUser(User user) {
        System.out.println("新增用户");
    }

    @InvokeLog
    public void updateUser(User user) {
        System.out.println("修改用户");
    }

    @InvokeLog
    public void deleteUser(Integer id) {
        System.out.println("删除用户");
    }

    @InvokeLog
    public User getUserById(Integer id) {
        System.out.println("查询用户");
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        return context.getBean(User.class);
    }

    @InvokeLog
    public void testUser(){
        System.out.println("测试用户");
    }
}
